unit TargetOracle;

interface

uses
  SysUtils, Classes, DB;

type
  TdmOracle = class(TDataModule)
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  function GetOracleFieldType(FieldType: TFieldType; DataSize: integer): string;

var
  dmOracle: TdmOracle;

implementation

{$R *.dfm}

function GetOracleFieldType(FieldType: TFieldType; DataSize: integer): string;
//const
//  CharacterSet = ' CHARACTER SET WIN1251 ';
begin
  Result := '';
  case FieldType of
    ftUnknown: Result := '/* ftUnknown */ varchar(50)';
    ftString: Result := 'NVARCHAR2';
    ftSmallint: Result := 'integer';
    ftInteger: Result := 'INTEGER';
    ftWord: Result := 'integer';
    ftBoolean: Result := 'integer';
    ftFloat: Result := 'NUMBER';
    ftCurrency: Result := 'number';
    ftBCD: Result := 'number';
    ftDate: Result := 'DATE';
    ftTime: Result := 'date';
    ftDateTime: Result := 'date';
    ftBytes: Result := 'number';
    ftVarBytes: Result := 'number';
    ftAutoInc: Result := 'integer';
    ftBlob: Result := 'BLOB';
    ftMemo: Result := 'varchar';
    ftGraphic: Result := 'blob';
    ftFmtMemo: Result := 'varchar';
    ftParadoxOle: ;
    ftDBaseOle: ;
    ftTypedBinary: Result := 'blob';
    ftCursor: ;
    ftFixedChar: ;
    ftWideString: Result := 'nvarchar';
    ftLargeint: Result := 'integer';
    ftADT: ;
    ftArray: ;
    ftReference: ;
    ftDataSet: ;
    ftOraBlob: Result := 'blob';
    ftOraClob: Result := 'clob';
    ftVariant: Result := 'varchar';
    ftInterface: Result := 'number';
    ftIDispatch: Result := 'number';
    ftGuid: Result := 'number';
    ftTimeStamp: Result := 'timestamp(6)';
    ftFMTBcd: ;
    ftFixedWideChar: Result := 'nchar';
    ftWideMemo: Result := 'nvarchar';
    ftOraTimeStamp: Result := 'timestamp(6)';
    ftOraInterval: Result := 'interval';
  end;

  case FieldType of
    ftUnknown,
    ftString,
    ftMemo,
    ftFmtMemo,
    ftWideString,
    ftVariant,
    ftFixedWideChar,
    ftWideMemo:
          begin
            if DataSize <> 0 then
              Result := Result + '(' + IntToStr(DataSize) + ')';

            if (DataSize = 0) then  //and (Result = 'varchar')
              Result := Result + '(100)';

            //Result := Result + CharacterSet;
          end;
  end;
end;

end.
